package com.jcl.recruit.resume.dao;

import com.jcl.core.db.DatabaseContext;
import com.jcl.recruit.resume.mapper.ResumeWorkMapper;
import com.jcl.recruit.resume.model.ResumeWork;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Component
public class ResumeWorkDao implements ResumeWorkMapper {

    @Autowired
    private ResumeWorkMapper resumeWorkMapper;

    @Override
    public List<ResumeWork> findListByResumeIds(String corpCode, List<Integer> resumeIds) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.findListByResumeIds(corpCode, resumeIds);
    }

    @Override
    public List<ResumeWork> findListByResumeId(String corpCode, Integer resumeId) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.findListByResumeId(corpCode, resumeId);
    }

    @Override
    public List<Map<String, Object>> findObjListByResumeId(String corpCode, Integer resumeId) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.findObjListByResumeId(corpCode, resumeId);
    }

    @Override
    public int isExitEntity(ResumeWork entity) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.isExitEntity(entity);
    }

    @Override
    public int batchInsert(List<ResumeWork> list) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.batchInsert(list);
    }

    @Override
    public int insert(ResumeWork entity) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.insert(entity);
    }

    @Override
    public int updateByPrimaryKey(ResumeWork entity) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.updateByPrimaryKey(entity);
    }

    @Override
    public int deleteById(Integer id) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.deleteById(id);
    }

    @Override
    public int batchDeleteByResumeIds(String corpCode, List<Integer> resumeIds) {
        DatabaseContext.setCurrentContext();
        return resumeWorkMapper.batchDeleteByResumeIds(corpCode, resumeIds);
    }
}
